<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="productdetail.aspx.cs" Inherits="productdetail" Title="Product Details" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <asp:GridView ID="gvProductDetail" runat="server" AutoGenerateColumns="False" DataSourceID="odsProduct" GridLines="None" 
                    ShowHeader="False" OnRowCommand="gvProductDetail_RowCommand" CssClass="myGridView">        
        <Columns>            
            <asp:TemplateField SortExpression="ProductName">
                <ItemTemplate>
                    <table>
                        <tr>
                            <td colspan="2">
                                <h3><asp:Label ID="lblProductName" runat="server" Text='<%# Bind("ProductName") %>' /></h3>
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-right:20px">
                                <asp:Image ID="imgProductImage" runat="server" ImageUrl='<%# Bind("Picture") %>' 
                                        BorderColor="Chocolate" BorderStyle="solid" BorderWidth="1px"/>
                            </td>
                            <td colspan="2">
                                Unit Price : <asp:Label ID="lblProductPrice" runat="server" Text='<%# Bind("UnitPrice", "{0:C}") %>' ForeColor="Red"/><br /><br />
                                Unit In Stock : <asp:Label ID="lblUnitInStock" runat="server" Text='<%# Bind("UnitsInStock") %>' ForeColor="Blue"/><br /><br />
                                <asp:ImageButton ID="imgAddToCart" runat="server" CommandName="AddToCart" ImageUrl="~/CoreLayout/Images/add-to-cart.png" CommandArgument='<%# Bind("ProductID") %>' />
                            </td>
                        </tr>
                    </table>
                    <br /><br />
                    <table style="border:solid 1px #D9D9D9; background-color:#F8F8F8;" cellpadding="5px">
                        <tr style="background-color:#3fb6cf">
                            <td>
                                <h3>Product Information :</h3>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom:dashed 1px #324a86">
                                <h2>Features :</h2>
                                <p>
                                    <asp:Label ID="lblFeatures" runat="server" Text='<%# Bind("Features") %>' />
                                </p>
                            </td>   
                        </tr>
                        <tr>
                            <td style="border-bottom:dashed 1px #324a86">                                
                                <p>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("Description") %>' />
                                </p>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                
                                <h2>Review :</h2>                               
                                <asp:Repeater ID="rpReview" runat="server" DataSource='<%# Bind("Review") %>'>
                                    <ItemTemplate>
                                        <asp:Table runat="server">
                                            <asp:TableRow>
                                                <asp:TableCell>
                                                    <asp:Image ID="lblStar" runat="server" ImageUrl='<%# Bind("ReviewStar") %>' />
                                                    <b style="text-decoration:underline; padding-left:10px"><asp:Label ID="lblReviewTitle" runat="server" Text='<%# "   " + DataBinder.Eval(Container.DataItem, "ReviewTitle") %>' /></b>
                                                </asp:TableCell>
                                            </asp:TableRow>
                                            <asp:TableRow>
                                                <asp:TableCell>
                                                    <div id="review">
                                                    <i><asp:Label ID="lblReviewDate" runat="server" Text='<%# "Posted on : " + DataBinder.Eval(Container.DataItem, "ReviewDate") %>' /></i>
                                                    <asp:Label ID="lblReviewUserName" runat="server" Text='<%# "   by " + "<b>" + DataBinder.Eval(Container.DataItem, "Username") + "</b>" %>' />
                                                    </div>
                                                </asp:TableCell>
                                            </asp:TableRow>
                                            <asp:TableRow BackColor="#d8d8d8">
                                                <asp:TableCell>
                                                    <p><asp:Label ID="nothing" runat="server" Text='<%# Bind("Contents") %>' /></p>                                                    
                                                </asp:TableCell>
                                            </asp:TableRow>
                                        </asp:Table>                                        
                                    </ItemTemplate>
                                </asp:Repeater>                                                                                                    
                            </td>
                        </tr>                       
                    </table>                    
                </ItemTemplate>
            </asp:TemplateField>                                    
        </Columns>
    </asp:GridView>        
    
    <asp:Panel ID="panelReview" runat="server">
    <table style="margin:10px auto; text-align:center; background-color:#e7e7e7" width="520px" cellpadding="5px">
        <tr>
            <td style="text-align:left">
                <b style="color:Navy">Write your review here</b>
            </td>
            <td>                
                Vote this product : <asp:DropDownList ID="ddlVote" runat="server">
                                        <asp:ListItem Text="0" Value="0" />
                                        <asp:ListItem Text="1" Value="1" />
                                        <asp:ListItem Text="2" Value="2" />
                                        <asp:ListItem Text="3" Value="3" />
                                        <asp:ListItem Text="4" Value="4" />
                                        <asp:ListItem Text="5" Value="5" />                    
                                    </asp:DropDownList> <img id="imgStar" src="CoreLayout/Images/Stars/one-star.png" alt="Vote star"/>
            </td>
        </tr>
        <tr  style="text-align:left">
            <td colspan="2">
                Title : <b style="padding-left:20px"><asp:TextBox ID="txtReviewTitle" runat="server" Width="255px"/></b>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:TextBox ID="txtNewReview" runat="server" TextMode="MultiLine" Rows="10" Width="400px"  MaxLength="500" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Button ID="btnCommitReview" runat="server" Text="Commit" OnClick="btnCommitReview_Click" />
                <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="lblReviewError" runat="server" ForeColor="Red"/>
            </td>
        </tr>
    </table>
    </asp:Panel>
    <asp:ObjectDataSource ID="odsProduct" runat="server" SelectMethod="GetByID" TypeName="Bll.ProductBll" >
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="1" Name="productID" QueryStringField="readID"
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>  

</asp:Content>

